package com.orange.delivery.presentation.panel;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.francetelecom.clara.component.wicket.app.popin.OPopinContainer;
import com.orange.delivery.model.MarketBean;
import com.orange.delivery.technicalservice.exception.InvalidMarketException;
import com.orange.delivery.technicalservice.exception.NotFoundException;

public class UpdateMarketPanel extends CreateOrUpdateMarketPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final Logger LOG = LoggerFactory.getLogger(UpdateMarketPanel.class.getName());

	public UpdateMarketPanel(String id, MarketBean marketBean, OPopinContainer modalPopIn) {
		super(id, marketBean, modalPopIn);

	}

	@Override
	protected void createComponents() {
		if (LOG.isDebugEnabled()) {
			LOG.debug("modal page for market update");

		}

	}

	@Override
	protected Action createOrUpdateMarket(MarketBean marketBean) throws InvalidMarketException, NotFoundException {
		if (LOG.isDebugEnabled()) {
			LOG.debug("updating market, parameters = " + marketBean.toString());
		}
		manageMarket.modifyMarket(marketBean);
		return Action.UPDATED;
	}

}
